package jp.co.cos.ittrick.channel.controller.admin.file;

import jp.co.cos.ittrick.channel.service.FileService;

import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;
import org.slim3.controller.upload.FileItem;

public class UploadForArticleController extends Controller {

	private FileService service = new FileService();

    @Override
    public Navigation run() {
        FileItem formFile = requestScope("formFile");
        String channel = asString("channel");
        String page = asString("page");
        String chapter = asString("chapter");

        service.uploadForPage(formFile, Integer.valueOf(page));

        return redirect("/admin/pageEdit?channel=" + channel + "&chapter=" + chapter + "&page=" + page);
    }

}
